﻿package phpas3{
	public function stripos( f_haystack:String, f_needle:String, f_offset:int=0 ):*{
	    // Finds position of first occurrence of a string within another, case insensitive
	    //
	    // version: 1109.2015
	    // discuss at: http://phpjs.org/functions/stripos
	    // +     original by: Martijn Wieringa
	    // +      revised by: Onno Marsman
	    // *         example 1: stripos('ABC', 'a');
	    // *         returns 1: 0
	    var haystack = (f_haystack + '').toLowerCase();
	    var needle = (f_needle + '').toLowerCase();
	    var index = 0;

	    if ((index = haystack.indexOf(needle, f_offset)) !== -1) {
	        return index;
	    }
	    return false;
	}
}